package com.zuoye.day18;

public class ThreadSaleTicket implements  Runnable{
    public int titcet = 20;
    @Override
    public void run() {
        while (true){
            synchronized (Thread.class){
                if (titcet > 0){

                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }

                    System.out.println(Thread.currentThread().getName() + "票号" + titcet);
                    titcet--;

                }else break;
            }
        }

    }
}
